﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Web.SystemConfig.Services;
using Web.SystemConfig.DataAccess;
using DreamBuilder.Common;

namespace Web.SystemConfig.Business
{
    public class BUSProfile : BusinessBase, IProfile
    {
        DALProfile dal;
        public BUSProfile()
        {
            dal = new DALProfile();
        }

        public DataTable SelectUserInfo(string UserID)
        {
            return dal.SelectUserInfo(UserID);
        }

        public DataTable SelectRolesByUserID(string UserID)
        {
            return dal.SelectRolesByUserID(UserID);
        }

        public DataSet SelectUserAuthoritiesAndModulesAll(string userID)
        {
            return dal.SelectUserAuthoritiesAndModulesAll(userID);
        }

        public DataSet GetRootDS(string ParentModuleID)
        {
            return dal.GetRootDS(ParentModuleID);
        }

        public DataSet GetAuthority(string userID, string Menu_ID)
        {
            return dal.GetAuthority(userID, Menu_ID);
        }

        public DataSet GetChild(string parentMenu_ID)
        {
            return dal.GetChild(parentMenu_ID);
        }

        public bool IsLeafMenu(string menuID)
        {
            DataTable dt = GetChild(menuID).Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}